package com.gdqy.FCS.web;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.gdqy.FCS.service.ClothingService;
import com.gdqy.FCS.service.DesignService;
import com.gdqy.FCS.service.DesignerInfoService;
import com.gdqy.FCS.service.EnterpriseInfoService;
import com.gdqy.FCS.service.FabricService;
import com.gdqy.FCS.service.InformationService;

@Controller
@RequestMapping("index")
public class IndexController {
	@Autowired
	private DesignService designService;
	@Autowired
	private ClothingService clothingService;
	@Autowired
	private EnterpriseInfoService enterpriseInfoService;
	@Autowired
	private DesignerInfoService designerInfoService;
	@Autowired
	private FabricService fabricService;
	@Autowired
	private InformationService informationService;
	
	@RequestMapping("index")
	public ModelAndView index(HttpServletRequest request,HttpServletResponse response) throws Exception {		
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("index"); 
		int design_count = designService.selectAllCount();
		modelAndView.addObject("design_count", design_count);
		
		int clothing_count =clothingService.selectAllCount();
		modelAndView.addObject("clothing_count", clothing_count);
		
		int enterprise_count = enterpriseInfoService.selectAllCount();
		modelAndView.addObject("enterprise_count", enterprise_count);
		
		int designer_count = designerInfoService.selectAllCount();
		modelAndView.addObject("designer_count", designer_count);
		
		int fabric_count = fabricService.selectAllCount();
		modelAndView.addObject("fabric_count", fabric_count);
		
		int information_count = informationService.selectAllCount();
		modelAndView.addObject("information_count", information_count);
		
	/*	//获取服装大类
		List<ClothingType> clothingTypes = clothingTypeService.selectClothing_class("");
		modelAndView.addObject("clothingTypes", clothingTypes);
		//获取服装设计--女装
		Dictionary dictionary = dictionaryService.selectByValue("女装设计");
		List<Design> designs_lady = designService.selectByStyle_code(dictionary.getCode());
		modelAndView.addObject("designs_lady", designs_lady);
		//获取服装设计--男装
		dictionary = dictionaryService.selectByValue("男装设计");
		List<Design> designs_man =designService.selectByStyle_code(dictionary.getCode());
		modelAndView.addObject("designs_man", designs_man);
		//获取男装分类
		
		//获取服装设计--童装
		dictionary = dictionaryService.selectByValue("童装设计");
		List<Design> designs_child =designService.selectByStyle_code(dictionary.getCode());
		modelAndView.addObject("designs_child", designs_child);
		//获取服装设计--内装
		dictionary = dictionaryService.selectByValue("内衣设计");
		List<Design> designs_underwear =designService.selectByStyle_code(dictionary.getCode());
		modelAndView.addObject("designs_underwear", designs_underwear);
		*/
		return modelAndView;
	}
	
}
